package com.atde._05_behavioral_design_patterns.observer.improve;


import java.util.Observable;
import java.util.Observer;

/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._05_behavioral_design_patterns.observer.improve
 * @Author: Del
 * @CreateTime: 2025-06-29  20:24
 * @Description: 客户端 --- 测试观察者模式实现
 * @Version: 1.0
 */
public class Client {
    public static void main(String[] args) {
        // 创建一个 WeatherData 对象
        WeatherData weatherData = new WeatherData();

        // 创建一个 CurrentConditions 对象即观察者
        CurrentConditions currentConditions = new CurrentConditions();

        // 将观察者加入到 weatherData 中 (注册)
        weatherData.registerObserver(currentConditions);

        // 测试
        System.out.println("通知各个注册的观察者，显示信息");
        weatherData.setData(10f, 100f, 30f);
        System.out.println("-----------------------------------------");
    }
}
